# ifndef __COMRoot_H_
# define __COMRoot_H_

# include "COMBase.h"
# include "GPSMapEditItf.h"

class CComRoot :
	public CComDualInterface<IApplication, & LIBID_GPSMapEdit>,
	public CComConnectionPoint<IApplicationEventsSink>
{
  public:
	CComRoot ();
	~CComRoot ();

	typedef CComDualInterface<IApplication, & LIBID_GPSMapEdit> Base_t;
	typedef CComConnectionPoint<IApplicationEventsSink> Base2_t;

	STDMETHOD_ (ULONG, AddRef)  () {return Base_t::AddRef ();}
	STDMETHOD_ (ULONG, Release) () {return Base_t::Release ();}
	STDMETHOD (QueryInterface) (REFIID _iid, void ** _ppvObject) {
		const HRESULT hr = Base_t::QueryInterface (_iid, _ppvObject);
		if (FAILED (hr))
			return Base2_t::QueryInterface (_iid, _ppvObject);
		return hr;
	}

	STDMETHOD (get_Version) (BSTR * _ret);
	STDMETHOD (MinimizeWindow) ();
	STDMETHOD (RestoreWindow) ();
	STDMETHOD (Exit) ();
	STDMETHOD (Close) ();
	STDMETHOD (Open) (BSTR _bstrFileName, VARIANT_BOOL _vbAdd, VARIANT_BOOL _vbWait);
	STDMETHOD (SaveAs) (BSTR _bstrFileName, BSTR _bstrFormat);
	STDMETHOD (get_FileOpenFilter) (BSTR * _ret);
	STDMETHOD (get_FileName) (BSTR * _ret);
	STDMETHOD (get_LastOpenedFiles) (long * _ret);
	STDMETHOD (LastOpenedFile) (long _lIndex, BSTR * _ret);
	STDMETHOD (GetView) (BSTR _strDeveloperKey, IView ** _ret);
	STDMETHOD (ConnectView) (BSTR _strDeveloperKey, long _hWndParent, IView ** _ret);
	STDMETHOD (ShowAboutBox) (long _hWndParent);
	STDMETHOD (ShowActivationBox) (long _hWndParent);
	STDMETHOD (get_IsRegistered) (VARIANT_BOOL * _ret);
	STDMETHOD (get_Edit) (IEdit ** _ret);
	STDMETHOD (get_Visible) (VARIANT_BOOL * _ret);
	STDMETHOD (put_Visible) (VARIANT_BOOL _Val);
	STDMETHOD (ResetModified) ();
};

extern CComRoot * g_pComRoot;

# endif // __COMRoot_H_